
#include <config.h>
#include <display_manager.h>
#include <string.h>

static PT_DisplayOpr g_ptDisplayOprHead;

int RegisterDisplayOpr(PT_DisplayOpr ptDisplayOpr)
{
	PT_DisplayOpr ptTmp;
	if(!g_ptDisplayOprHead)
	{
		g_ptDisplayOprHead = ptDisplayOpr;
		ptDisplayOpr->ptNext = NULL;
	}
	else
	{
		ptTmp = g_ptDisplayOprHead;
		while(ptTmp->ptNext)
		{
			ptTmp = ptTmp->ptNext;
		}
		ptTmp->ptNext = ptDisplayOpr;
		ptDisplayOpr->ptNext = NULL;
	}
	return 0;
}

void ShowDisplayOpr(void)
{
	int i = 0;
	PT_DisplayOpr ptTmp = g_ptDisplayOprHead;

	while(ptTmp)
	{
		printf("%d %s \n", ++i, ptTmp->name);
		ptTmp = ptTmp->ptNext;
	}
}

PT_DisplayOpr GetDisplayOpr(char *name)
{
	PT_DisplayOpr ptTmp = g_ptDisplayOprHead;
	
	while(ptTmp)
	{
		if(strcmp(ptTmp->name, name) == 0)
			return ptTmp;
		else
			ptTmp = ptTmp->ptNext;
	}
	return NULL;
}


int DisplayInit(void)
{
	int iError;

	iError = FBRegister();
	if(iError)
	{
		DBG_PRINTF("FBRegister Error\n");
		return -1;
	}
	return 0;
}

